package org.example.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.dto.UserLoginDto;
import org.example.entity.Condition;
import org.example.entity.User;
import org.example.vo.UserVO;

import java.util.List;

@Mapper
public interface UserMapper {


    /**
     * 登录
     * @param userLoginDto
     * @return
     */
    @Select("select * from user where username = #{username} and password_hash = #{passwordHash}")
    User login(UserLoginDto userLoginDto);

    /**
     * 注册
     * @param user
     * @return
     */
    @Insert("insert into user (username, password_hash) values (#{username}, #{passwordHash})")
    Boolean insert(User user);

    /**
     * 更新用户信息
     * @param userVO
     * @return
     */
    Boolean update(UserVO userVO);

    /**
     * 获取用户信息
     * @return
     */
    @Select("select * from user")
    List<User> getuser();


    List<User> getUserInfo(Condition condition);
}
